package org.smile.upload.http;


public class ReportItemFactory
{
    public static UploadReport create(String fileName, long beginTime,
            long totalSize, long uploadSize, long uploadTime,
            UploadReport reportItem)
    {
        if (reportItem == null)
        {
            return new DefaultUploadReport(fileName, beginTime, totalSize,
                uploadSize, uploadTime);
        }
        else
        {
            DefaultUploadReport defautItem = (DefaultUploadReport) reportItem;
            defautItem.reload();
            defautItem.setFileName(fileName);
            defautItem.setBeginTime(beginTime);
            defautItem.setTotalSize(totalSize);
            defautItem.setUploadSize(uploadSize);
            defautItem.setUploadTime(uploadTime);
            return defautItem;
        }
    }
}
